<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/md5.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
<!--
//通用选择删除条目（反选-全选）--------------------------------------------------------
function CheckOthers(form)
{
   for (var i=0;i<form.elements.length;i++)
   {
      var e = form.elements[i];
      if (e.checked==false)
      {
	     e.checked = true;
      }
      else
      {
	     e.checked = false;
      }
   }
}

function CheckAll(form)
{
   for (var i=0;i<form.elements.length;i++)
   {
      var e = form.elements[i];
      e.checked = true;
   }
}
function IsChar(s)
{ 
 var username = "0123456789.abcdefghijklmnopqrstuvwxyz-\/ABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()_";
 for (i = 0; i < s.length;i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (username.indexOf(c) == -1) return false;
    }
 return true
}
function chkform(formname){
	if(formname.admin_user.value==""){
		alert("请填写管理员用户名")
		return false
	}
	if (!IsChar(document.all.admin_user.value))
    {
		alert("帐号只能输入英文及数字，请不要输入中文！")
		document.all.admin_user.focus();
    return false;
    }
	if(formname.password.value==""){
		alert("请填写密码")
		return false
	}
	if (!IsChar(document.all.password.value))
    {
		alert("密码只能输入英文及数字，请不要输入中文！")
		document.all.password.focus();
        return false;
    }
	if(formname.password.value!=formname.password1.value){
		alert("两次输入的密码不同")
		return false
	}
	if (!IsChar(document.all.password1.value))
    {
		alert("密码只能输入英文及数字，请不要输入中文！")
		document.all.password1.focus();
        return false;
    }
	if(formname.admin_Name.value==""){
		alert("姓名不能为空")
		return false
	}
}
function chkform2(formname){
	if(formname.password.value!=formname.password1.value){
		alert("两次输入的密码不同")
		return false
	}
	if(formname.admin_Name.value==""){
		alert("姓名不能为空")
		return false
	}
}
-->
</script>
<!--添加管理员程序开始-->
<%
Call QuanXian1("$2$")
if Request("action")="add" then
	'判断管理员的用户名是否已经在在
	strsql="select * from [system_meng] where admin_user='"&Request.Form("admin_user")&"'"
	Set rs1=Server.CreateObject("ADODB.RecordSet")
	rs1.Open strsql,conn,1,1
	if not rs1.eof then
		Response.Write("管理员用户名不能重复，请重新添加")
		Response.Write("<a href='system_admin.asp'>返回</a>")
		Response.End()
	end if
	
	Set rs=Server.CreateObject("ADODB.RecordSet")
	strsql="select admin_user,admin_pwd,admin_Name,admin_bumen,quanxian from [system_meng]"
	rs.Open strsql,conn,1,3
	if not (rs.bof and rs.eof) then
	rs.addnew
	rs("admin_user")=Request.Form("admin_user")
	rs("admin_pwd")=md5(Request.Form("password")&IMS_CookieRndString)
	rs("admin_Name")=Request.Form("admin_Name")
	rs("admin_bumen")=Request.Form("admin_bumen")
	rs("quanxian")=Request.Form("quanxian")
	rs.update
	end if
	call rsclose(rs)
	Response.Write("<script>alert('管理员添加成功');parent.location='../manage_main.html'</script>")
end if
%>
<!--添加管理员程序结束-->

<!--修改管理员密码程序开始-->
<%
if Request("action")="Modify" then

	Set rs=Server.CreateObject("ADODB.RecordSet")
	strsql="select admin_pwd,admin_Name,admin_bumen,quanxian from [system_meng] where ID="&Request("id")&""
	rs.Open strsql,conn,1,3
	if not (rs.bof and rs.eof) then
	 IF Request("password")<>Empty Then
	 rs("admin_pwd")=md5(Request.Form("password")&IMS_CookieRndString)
	 end if
	 rs("admin_Name")=Request.Form("admin_Name")
	 rs("admin_bumen")=Request.Form("admin_bumen")
	 rs("quanxian")=Request.Form("quanxian")
	rs.update
	end if
	call rsclose(rs)
	
	Response.Write("<script>alert('管理员修改成功');parent.location='../manage_main.html'</script>")
end if
%>
<!--修改管理员密码程序结束-->

<!--删除管理员程序开始-->
<%
if Request("action")="del" then

	sqlDel="select * from [system_meng] where id="&Request("id")
	Set rsDel= Server.CreateObject("ADODB.Recordset")
	rsDel.open sqlDel,conn,1,3
	IF not(rsDel.eof or rsDel.bof) THEN
        rsDel.delete
        rsDel.update
	End IF
	call rsclose(rsDel)
	
	Response.Write("<script>alert('删除成功');window.location='system_admin.asp'</script>")
end if
%>
<!--删除管理员程序结束-->
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" height="500" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top">
<!--修改管理员密码表单开始-->
<%if Request("action")="changpwdform" then
sqlstr="select * from [system_meng] where id="&Request("id")
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open sqlstr,conn,1,1
%>
<form name="system_admin" method="post" action="system_admin.asp?action=Modify" onSubmit="return chkform2(this)">
  <table width="98%" border="0" cellpadding="0" cellspacing="0" class="table_border">
    <tr>
	  <td colspan="2" class="padding_1 table_bg table_bg_size" align="center">管理员帐号修改</td>
      </tr>
    <tr>
      <td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
        <tr class="table_bg_n">
          <td width="13%" height="30" align="center">帐&nbsp;&nbsp;&nbsp;&nbsp;户</td>
          <td width="87%" class="padding-left-10"><%=rs("admin_user")%></td>
        </tr>
        <tr class="table_bg_n">
          <td height="30" align="center">密&nbsp;&nbsp;&nbsp;&nbsp;码</td>
          <td class="padding-left-10"><input name="password" type="password" id="password" size="30" style="width:192px"><span class="huang style1">&nbsp;&nbsp;(不修改请保留空)</span></td>
        </tr>
        <tr class="table_bg_n">
          <td height="30" align="center">确认密码</td>
          <td class="padding-left-10"><input name="password1" type="password" id="password1" size="30" style="width:192px">
            </td>
        </tr>
        <tr class="table_bg_n">
          <td height="30" align="center">姓&nbsp;&nbsp;&nbsp;&nbsp;名</td>
          <td class="padding-left-10"><input name="admin_Name" type="text" id="admin_Name" value="<%=rs("admin_Name")%>" size="30" style="width:192px">&nbsp;&nbsp;<span class="style1">*</span></td>
        </tr>
        <tr class="table_bg_n">
          <td height="30" align="center">部&nbsp;&nbsp;&nbsp;&nbsp;门</td>
          <td class="padding-left-10"><input name="admin_bumen" type="text" id="admin_bumen" value="<%=rs("admin_bumen")%>" size="30" style="width:192px"></td>
        </tr>
		<tr class="table_bg_n" <%if quanxian_B=false then%>style="display:none"<%end if%>>
          <td align="center">权&nbsp;&nbsp;&nbsp;&nbsp;限</td>
          <td class="padding-left-10">
		   <div class="user"><input type="checkbox" name="quanxian" value="$2$" <%if instr(rs("quanxian"),"$2$")>0 then response.write("checked")%>>系统管理</div>
		   <%IF About_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$1$" <%if instr(rs("quanxian"),"$1$")>0 then response.write("checked")%>>基本信息管理</div><%end if%>
		   <%IF Products_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$3$" <%if instr(trim(rs("quanxian")),"$3$")>0 then response.write("checked")%>>产品管理</div><%end if%>
		   <%IF News_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$4$" <%if instr(rs("quanxian"),"$4$")>0 then response.write("checked")%>>新闻管理</div><%end if%>
		   <%IF Honor_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$5$" <%if instr(rs("quanxian"),"$5$")>0 then response.write("checked")%>>企业荣誉管理</div><%end if%>
		   <%IF Orders=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$6$" <%if instr(rs("quanxian"),"$6$")>0 then response.write("checked")%>>订单管理</div><%end if%>
		   <%IF Register_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$7$" <%if instr(rs("quanxian"),"$7$")>0 then response.write("checked")%>>会员管理</div><%end if%>
		   <%IF Job_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$8$" <%if instr(rs("quanxian"),"$8$")>0 then response.write("checked")%>>人力资源管理</div><%end if%>
		   <%IF GuestBook_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$9$" <%if instr(rs("quanxian"),"$9$")>0 then response.write("checked")%>>留言管理</div><%end if%>
		   <%IF Vote_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$10$" <%if instr(rs("quanxian"),"$10$")>0 then response.write("checked")%>>调查管理</div><%end if%>
		   <%IF Link_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$11$" <%if instr(rs("quanxian"),"$11$")>0 then response.write("checked")%>>友情链接管理</div><%end if%>
		   <%IF DownLoad_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$12$" <%if instr(rs("quanxian"),"$12$")>0 then response.write("checked")%>>下载管理</div><%end if%>
		   <%IF video_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$13$" <%if instr(rs("quanxian"),"$13$")>0 then response.write("checked")%>>视频管理</div><%end if%>
		   <%IF Banner_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$14$" <%if instr(rs("quanxian"),"$14$")>0 then response.write("checked")%>>Banner图片管理</div><%end if%>
		   <%IF equipment_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$15$" <%if instr(rs("quanxian"),"$15$")>0 then response.write("checked")%>>设备管理</div><%end if%>
		   <%IF Music_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$16$" <%if instr(rs("quanxian"),"$16$")>0 then response.write("checked")%>>音乐管理</div><%end if%>
		   <%IF Pic_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$17$" <%if instr(rs("quanxian"),"$17$")>0 then response.write("checked")%>>图片管理</div><%end if%>
		  </td>
		</tr>
		<tr class="table_bg_n" <%if quanxian_B=false then%>style="display:none"<%end if%>>
		   <td height="35" align="center">选&nbsp;&nbsp;&nbsp;&nbsp;择：</td>
		   <td class="padding-left-10"><input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button"  value="全 选"  style="padding-top:3px; cursor:pointer">&nbsp;&nbsp;<input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" value="反 选" style="padding-top:3px; cursor:pointer"></td>
		</tr>
        <tr class="table_bg_n">
          <td height="30" colspan="2" align="center"><input name="submit" type="submit" value=" 修 改 " style="padding-top:3px; cursor:pointer"><input type="hidden" name="id" id="id" value="<%=rs("id")%>"></td>
        </tr>
      </table>
	 </td>
    </tr>
  </table>
  </form>
<%end if%>
<!--修改管理员密码表单开始-->
<!--默认页开始-->
<%if Request("action")="" then%>
	<table width="98%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:25px;">
      <tr>
        <td align="center"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="table_border">
            <tr>
	          <td colspan="2" class="padding_1 table_bg table_bg_size" align="center"><strong>修改、删除管理员</strong></td>
            </tr>
            <tr>
              <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                  <tr class="table_bg_n">
                    <td width="20%"  height="30" align="center"><strong>管理员帐户</strong></td>
                    <td width="22%" align="center"><strong>姓&nbsp;&nbsp;名</strong></td>
                    <td width="24%" align="center"><strong>部&nbsp;&nbsp;门</strong></td>
                    <td width="18%" align="center"><strong>操作一</strong></td>
                    <td width="16%" align="center"><strong>操作二</strong></td>
                  </tr>
					<%
					sqlstr="select * from [system_meng] where admin_user<>'administrator'"
					Set rs=Server.CreateObject("ADODB.RecordSet")
					rs.Open sqlstr,conn,1,1
					do while not rs.eof
					%>
                  <tr align="center" class="table_bg_n">
                    <td height="30" align="center"><a href="system_admin.asp?action=changpwdform&id=<%=rs("id")%>"><%=rs("admin_user")%></a></td>
                    <td align="center"><a href="system_admin.asp?action=changpwdform&id=<%=rs("id")%>"><%=rs("admin_Name")%></a></td>
                    <td align="center"><a href="system_admin.asp?action=changpwdform&id=<%=rs("id")%>"><%=rs("admin_bumen")%></a></td>
                    <td align="center"><a href="system_admin.asp?action=changpwdform&id=<%=rs("id")%>">编辑</a></td>
                    <td align="center"><a href="system_admin.asp?action=del&id=<%=rs("id")%>" onClick="if (!confirm('确实要删除管理员吗？')){return false}">删除</a></td>
                  </tr>
					<%
					rs.movenext
					loop
					%>
              </table></td>
            </tr>
        </table></td>
      </tr>
    </table><table width="98%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center"><table width="100%"  border="0" cellpadding="0" cellspacing="0" class="table_border">
          <tr>
	          <td colspan="2" class="padding_1 table_bg table_bg_size" align="center">管理员帐号添加</td>
          </tr>
          <tr>
            <td><form name="system_admin" method="post" action="system_admin.asp?action=add" onSubmit="return chkform(this)" style="margin:0px;">
              <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                <tr class="table_bg_n">
                  <td width="13%" height="30" align="center">帐&nbsp;&nbsp;&nbsp;&nbsp;户</td>
                  <td width="87%" class="padding-left-10"><input name="admin_user" type="text" id="admin_user" size="30" style="width:192px">&nbsp;&nbsp;<span class="style1">* (带*必须填写)</span></td>
                </tr>
                <tr class="table_bg_n">
                  <td height="30" align="center">密&nbsp;&nbsp;&nbsp;&nbsp;码</td>
                  <td class="padding-left-10"><input name="password" type="password" id="password" size="30" style="width:192px">&nbsp;&nbsp;<span class="style1">*</span></td>
                </tr>
                <tr class="table_bg_n">
                  <td height="30" align="center">确认密码</td>
                  <td class="padding-left-10"><input name="password1" type="password" id="password1" size="30" style="width:192px">&nbsp;&nbsp;<span class="style1">*</span></td>
                </tr>
                <tr class="table_bg_n">
                  <td height="30" align="center">姓&nbsp;&nbsp;&nbsp;&nbsp;名</td>
                  <td class="padding-left-10"><input name="admin_Name" type="text" id="admin_Name" size="30" style="width:192px">&nbsp;&nbsp;<span class="style1">*</span></td>
                </tr>
                <tr class="table_bg_n">
                  <td height="30" align="center">部&nbsp;&nbsp;&nbsp;&nbsp;门</td>
                  <td class="padding-left-10"><input name="admin_bumen" type="text" id="admin_bumen" size="30" style="width:192px"></td>
                </tr>
				<tr class="table_bg_n" <%if quanxian_B=false then%>style="display:none"<%end if%>>
                  <td align="center">权&nbsp;&nbsp;&nbsp;&nbsp;限</td>
                  <td class="padding-left-10">
					<div class="user"><input type="checkbox" name="quanxian" value="$2$">系统管理</div>
					<%IF About_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$1$">基本信息管理</div><%end if%>
					<%IF Products_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$3$">产品管理</div><%end if%>
					<%IF News_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$4$">新闻管理</div><%end if%>
					<%IF Honor_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$5$">企业荣誉管理</div><%end if%>
					<%IF Orders=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$6$">订单管理</div><%end if%>
					<%IF Register_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$7$">会员管理</div><%end if%>
					<%IF Job_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$8$">人力资源管理</div><%end if%>
					<%IF GuestBook_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$9$">留言管理</div><%end if%>
					<%IF Vote_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$10$">调查管理</div><%end if%>
					<%IF Link_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$11$">友情链接管理</div><%end if%>
					<%IF DownLoad_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$12$">下载管理</div><%end if%>
					<%IF video_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$13$">视频管理</div><%end if%>
					<%IF Banner_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$14$">Banner图片管理</div><%end if%>
					<%IF equipment_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$15$">设备管理</div><%end if%>
					<%IF Music_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$16$">音乐管理</div><%end if%> 
					<%IF Pic_B=True Then%><div class="user"><input type="checkbox" name="quanxian" value="$17$">图片管理</div><%end if%>
				 </td>
				</tr>
				<tr class="table_bg_n" <%if quanxian_B=false then%>style="display:none"<%end if%>>
				 <td height="35" align="center">选&nbsp;&nbsp;&nbsp;&nbsp;择：</td>
				 <td class="padding-left-10"><input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button"  value="全 选">&nbsp;&nbsp;<input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" value="反 选"></td>
				</tr>
                <tr align="center" class="table_bg_n">
                  <td height="30" colspan="2"><input name="submit" type="submit" value="添加管理员" style="padding-top:3px; cursor:pointer">&nbsp;&nbsp;&nbsp;<input type="reset" style="padding-top:3px; cursor:pointer" name="Submit" value="重新填写"></td>
                </tr>
              </table>
            </form></td>
          </tr>
        </table></td>
      </tr>
    </table>
    <%end if%>
    </td>
  </tr>
</table>
</body>
</html>